import { axios } from '@/utils/request'

export function getCaseStatus() {
    return axios({
      url: '/caseStatus/getStatus',
      method: 'get',
    })
}

export function getTypeList() {
  return axios({
    url: '/caseType/getType',
    method: 'get',
  })
}

export function getProTeamList() {
  return axios({
    url: '/projectTeam/getProjectTeamList',
    method: 'get',
  })
}

export function uploadFile(formData){
  return axios({
    url:'/case/upload',
    method:'post',
    data:formData,
    headers: {
      'Content-Type':
        'multipart/form-data;boundary=' + new Date().getTime(),
    },
  })
}

export function addCase(caseform,editform,caseId,createBy) {
  return axios({
    url: '/case/add',
    method: 'post',
    data:{'caseform':caseform,'editform':editform,'caseId':caseId,'createBy':createBy},
  })
}

export function getCaseList(caseform,currentpage,pageSize) {
  return axios({
    url: '/case/getCaseList',
    method: 'post',
    data:{'caseDTO':caseform,'currentpage':currentpage,'pageSize':pageSize}
  })
}

export function getCaseDetail(caseId){
  return axios({
    url: '/case/getCaseDetail',
    method: 'post',
    data:{'caseId':caseId}
  })
}

export function editCase(caseform){
  return axios({
    url: '/case/editCase',
    method: 'post',
    data:caseform
  })
}

export function delCase(caseId){
  return axios({
    url: '/case/delCase',
    method: 'post',
    data:caseId
  })
}

export function returnCase(caseId){
  return axios({
    url: '/case/returnCase',
    method: 'post',
    data:caseId
  })
}

export function auditCase(caseId){
  return axios({
    url: '/case/auditCase',
    method: 'post',
    data:caseId
  })
}

export function downloadModule(file){
  return axios({
    url: '/case/downloadModule/'+file,
    method: 'get',
    responseType:'blob' 
  })
}

export function downloadFile(file){
  return axios({
    url: '/case/downloadFile/'+file,
    method: 'get',
    responseType:'blob' 
  })
}

export function modifyExcel(file,caseId){
  return axios({
    url: '/case/modifyExcel',
    method: 'post',
    data:{'query':file,'caseId':caseId}
  })
}


export function cacelCase(caseId){
  return axios({
    url: '/case/cacelCase',
    method: 'post',
    data:caseId
  })
}

export function getPrincipalList() {
  return axios({
    url: '/case/getUsers',
    method: 'get',
  })
}

export function orderCase(caseIds) {
  return axios({
    url: '/case/orderCase',
    method: 'post',
    data:{'caseId':caseIds,"userId":'dev'}
  })
}

export function exportCase(caseIds) {
  return axios({
    url: '/case/exportCase',
    method: 'post',
    data:caseIds
  })
}


export function getDevCaseList(caseform,currentpage,pageSize,username) {
  return axios({
    url: '/case/getDevCaseList',
    method: 'post',
    data:{'caseDTO':caseform,'currentpage':currentpage,'pageSize':pageSize,'username':username}
  })
}

export function downloadESB(file){
  return axios({
    url: '/case/downloadESB',
    method: 'post',
    responseType:'blob' ,
    data:{"filename":file}
  })
}

export function getDevelopCaseList(caseform,currentpage,pageSize,username) {
  return axios({
    url: '/case/getDevelopCaseList',
    method: 'post',
    data:{'caseDTO':caseform,'currentpage':currentpage,'pageSize':pageSize,'username':username}
  })
}

export function uploadesbFile(formData){
  return axios({
    url:'/case/uploadEsb',
    method:'post',
    data:formData,
    headers: {
      'Content-Type':
        'multipart/form-data;boundary=' + new Date().getTime(),
    },
  })
}
